
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setCharacterEncoding("utf-8");
    String username = request.getParameter("username");
    String password  = request.getParameter("password");
    //验证用户名密码 admin 123456
    if ("admin".equals(username)&&"123456".equals(password)){
        Cookie cookie = new Cookie("blogUser","admin");
        cookie.setMaxAge(1*20);  //20秒内不用登录
        response.addCookie(cookie); //回写到客户端
        response.sendRedirect("welcome.jsp");
    }else {
        response.sendRedirect("login3.jsp");
    }
%>